package sf.dsl.example;

/**
 * 条件运算符 <li>=等于</li> <li>>大于</li> <li>< 小于</li> <li>>=大于等于</li> <li><= 小于等于
 * </li> <li>!= 不等于</li> <li>^= 匹配字符串头</li> <li>$= 匹配字符串尾</li> <li>*=
 * 匹配字符串任意位置</li> <li>in in</li> <li>[] BETWEEN</li>
 */
public enum DBOperator {
    EQUALS("="),
    GREAT(">"),
    LESS("<"),
    GREAT_EQUALS(">="),
    LESS_EQUALS("<="),
    LIKE("like"),
    LIKE_ESCAPE("like"),
    NOT_LIKE("not like"),
    NOT_LIKE_ESCAPE("not like"),
    IN("in"),
    NOT_IN("not in"),
    NOT_EQUALS("<>"),
    BETWEEN("BETWEEN"),
    NOT_BETWEEN("NOT BETWEEN"),
    IS_NULL("is null"),
    IS_NOT_NULL("is not null"),

    /**
     * 什么都不做
     */
    NOTHING(""),
    /**
     * 无用
     */
    MATCH_ANY("*=", " like "),
    /**
     * 无用
     */
    MATCH_START("^=", " like "),
    /**
     * 无用
     */
    MATCH_END("$=", " like ");

    DBOperator(String key, String oper) {
        this.key = key;
        this.oper = oper;
    }

    DBOperator(String key) {
        this.key = key;
        this.oper = key;
    }

    private String key;
    private String oper;

    public String getKey() {
        return key;
    }

    public String getOper() {
        return oper;
    }
}